<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>图书后台管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="Xadmin/css/font.css">
    <link rel="stylesheet" href="Xadmin/css/xadmin.css">
    <link rel="stylesheet" href="Xadmin/css/login.css">
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script src="layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="Xadmin/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        var is_remember = false;
    </script>
</head>
<body class="login-bg">
<div class="login" >
    <div class="message">后台管理系统后台登录</div>
    <form method="post" style="margin-top: 2rem">
        <div></div>
        <input name="address" placeholder="请输入手机号" type="phone" lay-verify="required" class="layui-input" id="phone">
        <hr class="hr15">
        <div>
            <input name="text" style="float: left;" lay-verify="required" placeholder="密码" type="password"
                   class="layui-input" id="upwd">
        </div>
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="button" onclick="login()">
        <hr class="hr20">
        <hr class="hr20">
    </form>
</div>
</body>
<script>
    function login(){
        if ($("#phone").val()!='' && $("#pwd").val()!=''){
            $.ajax({
                url:"http://127.0.0.1:8081/User/User",
                method:"get",
                data:{
                    phone:$("#phone").val()
                    , upwd: $("#upwd").val()
                },
                success: function (res) {
                    var object = JSON.parse(res)
                    if (object.code === '0') {
                        layer.alert("登录成功")
                        setTimeout("javascript:location.href='index.html'", 1000);
                    } else {
                        layer.alert("登录失败，请检查用户名与密码")
                    }
                    reload()
                }
            })
        }else{
            layer.alert("用户名或密码为空")
        }

    }
</script>
</html>